package com.qianfeng.ssm.controller.advice;

import com.qianfeng.ssm.dto.Result;
import com.qianfeng.ssm.exceptions.MyBaseException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Zhao_Win
 * @version V1.0
 * @Project AllDay
 * @Date 2022/3/10 21:28
 */
@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {

    @ExceptionHandler(MyBaseException.class)
    public Result processMyBaseExc(MyBaseException exception){
        return Result.setFail(exception.getCode(),exception.getMessage(),null);
    }


}
